#include <stdio.h>

#define Max(a,b) ((a)>(b)?(a):(b))

int maxSatisfied(int* customers, int customersSize, int* grumpy, int grumpySize, int minutes) {
    int normal=0,max;
    for( int i=0; i < customersSize; i++ )
        if( 0 == grumpy[i] )
            normal+=customers[i];
    max=normal;
    for( int i=0; i < customersSize; i++ ){
        if( 1 == grumpy[i] )
            normal+=customers[i];
        if( i < minutes-1 )
            continue;
        max=Max(max,normal);
        if( 1 == grumpy[ i-minutes+1 ] )
            normal-=customers[ i-minutes+1 ];
    }
    return max;
}

int main(){
    //int c[]={1,0,1,2,1,1,7,5};
    int c[]={1};
    int g[]={0};
    //int g[]={0,1,0,1,0,1,0,1};
    int m=1;
    printf("%d\n",maxSatisfied(c,sizeof(c)/sizeof(int),\
        g,sizeof(g)/sizeof(int),m));
    return 0;
}
